package www.wen.com.common.lib.view

import android.graphics.Rect
import android.util.Log
import android.view.View
import androidx.recyclerview.widget.RecyclerView

class SpaceItemDecoration(private val space: Int, private val count: Int) :
    RecyclerView.ItemDecoration() {

    override fun getItemOffsets(
        outRect: Rect,
        view: View,
        parent: RecyclerView,
        state: RecyclerView.State
    ) {
        if (parent.getChildLayoutPosition(view) % (count - 1) == 0) {
            outRect.right = 0
        } else {
            outRect.right = space
        }
        outRect.left = space
        outRect.bottom = space
    }

}